/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package backingBean;

import entites.Members;
import entites.Message;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;
import manager.MessageManager;

/**
 *
 * @author ambaye
 */
@ManagedBean
@RequestScoped
public class EnvoyeMessage {
    @ManagedProperty(value="#{login.members}")
    private Members lemembre;
    private Message lemessage;

    public Message getLemessage() {
        return lemessage;
    }

    public void setLemessage(Message lemessage) {
        this.lemessage = lemessage;
    }

    public Members getLemembre() {
        return lemembre;
    }

    public void setLemembre(Members lemembre) {
        this.lemembre = lemembre;
    }
    
    private Message message; 
    

    public Message getMessage() {
        return message;
    }

    public void setMessage(Message message) {
        this.message = message;
    }
    

    /**
     * Creates a new instance of EnvoyeMessage
     */
    public EnvoyeMessage() {
    }
    @PostConstruct
   public void init() {
       message= new Message();       
    
}
    public  void  inserermessage(){
        
        message.getContentMessage();
        message.getIdMembers();
        message.getIdFromMembers();
       
      MessageManager.insertMessage(message);
      
     
        
    }
}

